public class UsbPrintDriver extends BaseDriver
Modifier and Type | Field and Description |
---|---|
protected static Pos |
mPos |
protected static PL2303Driver |
mSerial |
protected static USBSerialPort |
serialPort |
printListener
Constructor and Description |
---|
UsbPrintDriver(UsbConfigBean usbConfigBean) |
Modifier and Type | Method and Description |
---|---|
boolean |
connect(android.hardware.usb.UsbDevice usbDevice,
android.content.Context context,
android.app.PendingIntent mPermissionIntent) |
void |
disconnect() |
ConnectStateEnum |
getConnectState() |
UsbInterface |
getPrinterInterface() |
byte[] |
readMsg(int readLength) |
void |
run() |
void |
setPrinterInterface(UsbInterface printerInterface) |
void |
writeMsg(byte[] out)
同步,在主线程写数据
|
void |
writeMsgAsync(byte[] out)
异步写数据到打印机
|
getisAlwaysReadInputStream, getIsPrinting, getPrintListener, input2byte, seIsPrinting, setAlwaysReadInputStream, setPrintListener
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
protected static USBSerialPort serialPort
protected static PL2303Driver mSerial
protected static Pos mPos
public UsbPrintDriver(UsbConfigBean usbConfigBean)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public boolean connect(android.hardware.usb.UsbDevice usbDevice, android.content.Context context, android.app.PendingIntent mPermissionIntent) throws java.lang.Exception
java.lang.Exception
public void disconnect()
public void setPrinterInterface(UsbInterface printerInterface)
public UsbInterface getPrinterInterface()
public ConnectStateEnum getConnectState()
getConnectState
in class BaseDriver
public void writeMsg(byte[] out)
out
- public void writeMsgAsync(byte[] out)
out
- public byte[] readMsg(int readLength)